package com.vict.framework.pay.taskimpl;


import com.vict.framework.pay.service.FramworkPayInnerService;
import com.vict.framework.task.annotation.TaskConsumerConfiguration;
import com.vict.framework.task.bean.dto.Task;
import com.vict.framework.task.bean.dto.TaskConsumeResult;
import com.vict.framework.task.core.TaskExecute;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

@Slf4j
@TaskConsumerConfiguration(type = PayCallTask.type, sameTimeWorkNum = 20,
    failRetryTimeSeconds={
        1*60, 2*60, 5*60, 10*60
    })
public class PayCallTask implements TaskExecute<String> {
    public static final String type = "PayCallTask";

    @Autowired
    private FramworkPayInnerService framworkPayInnerService;

    @Override
    public TaskConsumeResult doConsume(Task task, String payDtoId) {
        framworkPayInnerService.payCall(payDtoId);
        return task.commitConsumer();
    }
}
